<extend file="resource/view/home">
	<block name="content">
		<div id="List-main">
<!--					判断如果是子级商品过来的数据-->
		<if value="$fatherData">
			<div class="main_classification miaobaoxie">

				<a href="{{u('entry.index')}}">首页</a><span>></span>
				<foreach from="$fatherData" value="$v">
				<a href="{{u('index',['cid'=>$v['cid']])}}"> {{$v['cname']}}</a><span>></span>
				</foreach>

			</div>
		<else>
			<div class="main_classification">

				<a href="{{u('entry.index')}}">首页</a><span>></span>
				<b>{{$cateData['cname']}}</b>
			</div>
		</if>

			<script>
				$(function(){
					//去掉最后一个span
					$('.miaobaoxie span:last').remove();
//					//点击添加class
//					$('.main_table').find('dl dd a').click(function(){
//						$(this).addClass('color').parents('dd').siblings('dd').find('a').removeClass("color");})
				})
			</script>
			<!--分类-->
			<div class="main_table">

				<ul>
		<if value="$cateData['son']">
<!--			如果是顶级分类-->
					<li>
						<dl>
							<dt>分类：</dt>
							<dd><a class="color" href="{{u('index',['cid'=>$cateData['cid']])}}">全部</a></dd>
							<foreach from="$cateData['son']" key="$k" value="$v">
							<dd><a href="{{u('index',['cid'=>$k])}}">{{$v}}</a></dd>
							</foreach>

						</dl>
					</li>
	<!--						如果是子级分类-->
	<elseif value="$fatherData" />
			<foreach from="$final" key="$k" value="$v">
				<li>
					<?php
//					//为了不破坏$param通过$param判断  用$temp传值
						$temp = $param;
						$temp[$k] = 0;
					?>
					<dl>
						<dt>{{$v['name']}}：</dt>
						<dd><a <if value="$param[$k]==0">style="color:red"</if> href="{{u('listPage.index',['cid'=>q('get.cid'),'param'=>implode('_',$temp)])}}">全部</a></dd>
						<foreach from="$v['value']" value="$vv">
							<?php $temp[$k] = $vv['gaid'] ?>
							<dd>
								<a <if value="$param[$k]==$vv['gaid']">style="color:red"</if> href="{{u('listPage.index',['cid'=>q('get.cid'),'param'=>implode('_',$temp)])}}">{{$vv['gavalue']}}</a>
							</dd>
						</foreach>
					</dl>
				</li>
			</foreach>
				</ul>
			</div>
	<else/>
<!--			如果是品牌-->
	</if>
			<div class="main_content">
				<ul>
<!--循环商品-->
					<if value="$goodsData">
					<foreach from="$goodsData" key="$k" value="$v">
					<li>
								<a href="{{u('show.index',[gid=>$v['gid']])}}"><img src="{{$v['pic']}}"/></a>
								<div class="main_content-text">
									<p>
										<a href="{{u('show.index',[gid=>$v['gid']])}}">
											{{$v['gname']}}
											<span>{{$v['describe']}}</span>
										</a>
									</p>
									<p >

										<span class="money">￥{{$v['shopprice']}}</span>
									</p>
								</div>
								<div class="main_content_bottom">
									<a href="{{u('show.index',[gid=>$v['gid']])}}">选购</a>
									<span>已有{{$v['click']}}人查看了</span>

								</div>
							</li>
						</foreach>
						<else>
							<b style=" display:block; width: 1220px;height:50px ; color: red;font-size: 20px;text-align: center;" >没商品</b>
					</if>
				</ul>

			</div>
		</div>
	</block>